<%--
  Created by IntelliJ IDEA.
  User: MySunshine
  Date: 2022/10/24
  Time: 15:39
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>用户注册</title>
    <link rel="stylesheet" href="../../layui/css/layui.css">
    <style>
        body{
            color: rgba(153, 149, 149, 0.94);
            font-size: 20px;
            margin: 0;
            padding: 0;
            text-align: center;
            background: linear-gradient(#25517f, #17649d);
            background-size: 100%;
        }
        .ma{
            position: absolute;
            right: 60px;
        }
    </style>
</head>
<body>
<div class="layui-row layui-col-md4 layui-col-md-offset4 " >
<form class="layui-form" action="/userReg">
      <h1 style="padding: 50px">注册</h1>
    <div class="layui-form-item">
        <label class="layui-form-label">姓名</label>
        <div class="layui-input-block">
            <input type="text" name="name" required  lay-verify="required" placeholder="请输入姓名" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-block">
            <input type="password" name="pwd" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">年龄</label>
        <div class="layui-input-block">
            <input type="number" name="age" required  max="150" min="10" lay-verify="required" placeholder="请输入年龄" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">性别</label>
        <div class="layui-input-block">
            <input type="radio" name="sex" value="男" title="男">
            <input type="radio" name="sex" value="女" title="女" checked>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">电话</label>
        <div class="layui-input-block">
            <input type="tel" name="phone" pattern="^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$"  required   lay-verify="required" placeholder="请输入电话" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">喜欢类型</label>
        <div class="layui-input-block">
            <select  name="kid" lay-verify="required" >
                <option>请选择类型</option>
                <c:forEach var="k" items="${kinds}" >
                    <option  value="${k.kid}">${k.kind}</option>
                </c:forEach>
            </select>
        </div>
    </div>
    <div class="ma"> <a href="javascript:change()" ><img src="/showCode" id="imgCode" alt="随机验证码"></a></div>
    <div class="layui-form-item">

       <label class="layui-form-label">验证码</label>
        <div class="layui-input-inline">
            <input type="text" name="inputCode" required  lay-verify="required" placeholder="请输入验证码" autocomplete="off" class="layui-input">
       </div>

    </div>


    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="formDemo">提 交</button>
            <button type="reset" class="layui-btn layui-btn-danger">重 置 </button>
        </div>
    </div>
</form>
</div>
</body>
<script src="../../layui/layui.js"></script>
<script>
    function change() {
        let img = document.getElementById("imgCode");
        img.src = "/showCode?"+Math.random();
    }
    //Demo
    layui.use('form','jquery','layer',function(){
        //监听提交
        form.on('submit(formDemo)', function(data){
            layer.msg(JSON.stringify(data.field));
            return false;
        });
    });
</script>
</html>
